package com.ycy;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.ServletContextEvent;

public class ServletContextListener implements javax.servlet.ServletContextListener {

  Logger logger = LoggerFactory.getLogger(this.getClass());

  @Override
  public void contextInitialized(ServletContextEvent servletContextEvent) {
    logger.warn(" 监听器 。。。");
    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
      @Override
      public void run() {
        logger.warn("jvm的关闭 钩子方法");
      }
    }));
  }

  @Override
  public void contextDestroyed(ServletContextEvent sce) {

  }

}
